<?php

include '../connectBDD.php';
$idEvent = $_GET['id_event'];
$result = mysql_query("SELECT U.avatar_path,U.login FROM user U INNER JOIN event_user EU ON U.login = EU.login_user where EU.id_event = " . $idEvent);
if (!$result) {
    echo mysql_error();
}
$i = 0;
$nb = 1;
while ($rows = mysql_fetch_assoc($result)) {
    
    if($i%4 == 0){
            echo "<div>";
        }
        $i++;
        echo "<div class='userEvent'>
                                <a href='profil.php?login=" . $rows['login'] . "'>
                                    <img src=" . $rows['avatar_path'] . " alt=" . $rows['login'] . " width=50px height=50px'/>
                                </a>
                              </div>";
        if ($i == 4 || $nb == mysql_num_rows($result)){
            echo '</div>';
            $i = 0;
        }
        $nb++;
}
?>
